//package com.quartet.modules.equipment.controller;
//
//
//import cn.hutool.core.bean.BeanUtil;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.api.ApiController;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.quartet.api.ApiResult;
//import com.quartet.api.PageResult;
//import com.quartet.modules.equipment.dto.TFuelConsumptionAlarmRuleInfoAddRequestDto;
//import com.quartet.modules.equipment.dto.TFuelConsumptionAlarmRuleInfoQueryRequestDto;
//import com.quartet.modules.equipment.dto.TFuelConsumptionAlarmRuleInfoResponseDto;
//import com.quartet.modules.equipment.entity.TFuelConsumptionAlarmRuleInfo;
//import com.quartet.modules.equipment.service.TFuelConsumptionAlarmRuleInfoService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * 油耗报警规则信息表(TFuelConsumptionAlarmRuleInfo)表控制层
// *
// * @author makejava
// * @since 2021-05-04 16:35:44
// */
//@RestController
//@RequestMapping("tFuelConsumptionAlarmRuleInfo")
//@Api(tags = "业务：油耗报警规则信息")
//@Slf4j
//public class TFuelConsumptionAlarmRuleInfoController  {
//    /**
//     * 服务对象
//     */
//    @Resource
//    private TFuelConsumptionAlarmRuleInfoService tFuelConsumptionAlarmRuleInfoService;
//
//    /**
//     * 分页查询所有数据
//     *
//     * @param tFuelConsumptionAlarmRuleInfoQueryRequestDto 查询实体
//     * @return 所有数据
//     */
//    @ApiOperation("分页查询所有油耗报警规则信息")
//    @PostMapping("/selectFuelConsumptionAlarmRulePage")
//    public ApiResult<PageResult<TFuelConsumptionAlarmRuleInfoResponseDto>> selectFuelConsumptionAlarmRulePage(@RequestBody TFuelConsumptionAlarmRuleInfoQueryRequestDto tFuelConsumptionAlarmRuleInfoQueryRequestDto) {
//        log.info("---------selectFuelConsumptionAlarmRulePage begin, tFuelConsumptionAlarmRuleInfoQueryRequestDto is {}----------", tFuelConsumptionAlarmRuleInfoQueryRequestDto);
//        IPage<TFuelConsumptionAlarmRuleInfo> page = new Page<>(tFuelConsumptionAlarmRuleInfoQueryRequestDto.getCurrent(), tFuelConsumptionAlarmRuleInfoQueryRequestDto.getLimit());
//        QueryWrapper<TFuelConsumptionAlarmRuleInfo> queryWrapper = new QueryWrapper<>();
//        if (!StringUtils.isNotBlank(tFuelConsumptionAlarmRuleInfoQueryRequestDto.getFuelConsumptionAlarmRuleName())) {
//            queryWrapper.lambda().like(TFuelConsumptionAlarmRuleInfo::getFuelConsumptionAlarmRuleName, tFuelConsumptionAlarmRuleInfoQueryRequestDto.getFuelConsumptionAlarmRuleName());
//        }
//        IPage<TFuelConsumptionAlarmRuleInfo> dbResult = tFuelConsumptionAlarmRuleInfoService.page(page, queryWrapper);
//        PageResult<TFuelConsumptionAlarmRuleInfoResponseDto> pageResult = new PageResult();
//        List<TFuelConsumptionAlarmRuleInfoResponseDto> tFuelConsumptionAlarmRuleInfoResponseDtoList = dbResult.getRecords().stream().map(tFuelConsumptionAlarmRuleInfo -> {
//            TFuelConsumptionAlarmRuleInfoResponseDto tFuelConsumptionAlarmRuleInfoResponseDto = BeanUtil.copyProperties(tFuelConsumptionAlarmRuleInfo, TFuelConsumptionAlarmRuleInfoResponseDto.class);
//            return tFuelConsumptionAlarmRuleInfoResponseDto;
//        }).collect(Collectors.toList());
//        pageResult.setTotal(dbResult.getTotal());
//        pageResult.setData(tFuelConsumptionAlarmRuleInfoResponseDtoList);
//        log.info("---------selectFuelConsumptionAlarmRulePage end, data is {}----------", pageResult);
//        return ApiResult.ok(pageResult);
//    }
//
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @ApiOperation("通过主键查询单条油耗报警规则信息")
//    @GetMapping("/selectFuelConsumptionAlarmRuleById")
//    public ApiResult<TFuelConsumptionAlarmRuleInfoResponseDto> selectFuelConsumptionAlarmRuleById(@RequestParam("id") Integer id) {
//        log.info("---------selectFuelConsumptionAlarmRuleById begin, id is {}----------", id);
//        TFuelConsumptionAlarmRuleInfo tFuelConsumptionAlarmRuleInfo = tFuelConsumptionAlarmRuleInfoService.getById(id);
//        TFuelConsumptionAlarmRuleInfoResponseDto tFuelConsumptionAlarmRuleInfoResponseDto = BeanUtil.copyProperties(tFuelConsumptionAlarmRuleInfo, TFuelConsumptionAlarmRuleInfoResponseDto.class);
//        return ApiResult.ok(tFuelConsumptionAlarmRuleInfoResponseDto);
//    }
//
//    /**
//     * 新增数据
//     *
//     * @param tFuelConsumptionAlarmRuleInfoAddRequestDto 实体对象
//     * @return 新增结果
//     */
//    @ApiOperation("新增油耗报警规则信息")
//    @PostMapping("/add")
//    public ApiResult addFuelConsumptionAlarmRule(@RequestBody TFuelConsumptionAlarmRuleInfoAddRequestDto tFuelConsumptionAlarmRuleInfoAddRequestDto) {
//        log.info("---------addFuelConsumptionAlarmRule begin, tFuelConsumptionAlarmRuleInfoAddRequestDto is {}----------", tFuelConsumptionAlarmRuleInfoAddRequestDto);
//        TFuelConsumptionAlarmRuleInfo tFuelConsumptionAlarmRuleInfo = BeanUtil.copyProperties(tFuelConsumptionAlarmRuleInfoAddRequestDto, TFuelConsumptionAlarmRuleInfo.class);
//        return ApiResult.ok(this.tFuelConsumptionAlarmRuleInfoService.save(tFuelConsumptionAlarmRuleInfo));
//    }
//
//    /**
//     * 修改数据
//     *
//     * @param tFuelConsumptionAlarmRuleInfoAddRequestDto 实体对象
//     * @return 修改结果
//     */
//    @ApiOperation("修改油耗报警规则信息")
//    @PutMapping("update")
//    public ApiResult updateFuelConsumptionAlarmRule(@RequestBody TFuelConsumptionAlarmRuleInfoAddRequestDto tFuelConsumptionAlarmRuleInfoAddRequestDto) {
//        log.info("---------updateFuelConsumptionAlarmRule begin, tFuelConsumptionAlarmRuleInfoAddRequestDto is {}----------", tFuelConsumptionAlarmRuleInfoAddRequestDto);
//        TFuelConsumptionAlarmRuleInfo tFuelConsumptionAlarmRuleInfo = BeanUtil.copyProperties(tFuelConsumptionAlarmRuleInfoAddRequestDto, TFuelConsumptionAlarmRuleInfo.class);
//        return ApiResult.ok(this.tFuelConsumptionAlarmRuleInfoService.updateById(tFuelConsumptionAlarmRuleInfo));
//    }
//
//    /**
//     * 删除数据
//     *
//     * @param id 主键结合
//     * @return 删除结果
//     */
//    @ApiOperation("删除油耗报警规则信息")
//    @DeleteMapping("/delete")
//    public ApiResult deleteFuelConsumptionAlarmRule(@RequestParam("id") Integer id) {
//        return ApiResult.ok(this.tFuelConsumptionAlarmRuleInfoService.removeById(id));
//    }
//}
